package cn.kgc.controller.logic.administrative;

import cn.kgc.pojo.Dict;
import cn.kgc.pojo.Meetingreserve;
import cn.kgc.service.administrative.nbw_meetingYDService;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.sql.Date;
import java.util.List;

@Controller
@RequestMapping("/nmyd")
public class nbw_meetingYDController {

    @Resource
    private nbw_meetingYDService yd;

    @RequestMapping("/indexYD")
    public String indexYD(){
        return "administrative/nbw-indexYD";
    }

    @RequestMapping("selMeeting")
    @ResponseBody
    public String selMeeting(@RequestParam String endtime){
        List<Dict> list=yd.selMeeting("%"+endtime+"%");
        return JSON.toJSONStringWithDateFormat(list,"yyyy-MM-dd HH:mm");
    }

    @RequestMapping("addindexYD")
    @ResponseBody
    public boolean addindexYD(@ModelAttribute Meetingreserve meetingreserve,String endtimes){
        System.out.println("endTimes----------------------------- = " + endtimes);
        meetingreserve.setEndtime(endtimes);

        boolean s=yd.addindexYD(meetingreserve);
        return s;
    }

}
